<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddTeamToUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->decimal('dividend_team_reward', 10, 2)->default(0)->comment('累计团队奖励');
            $table->unsignedInteger('team_number')->default(0)->comment('团队人数');
            $table->decimal('dividend_parent_reward', 10, 10)->default(0)->index()->comment('累计直推奖励');
            $table->decimal('resold_profit', 10, 2)->default(0)->index()->comment('寄售利润');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
             $table->dropColumn(['dividend_team_reward','team_number','dividend_parent_reward','resold_profit']);
        });
    }
}
